//
//  LZQ_DiscoverVC.swift
//  SwiftExercise
//
//  Created by 罗宗庆 on 2021/6/23.
//

import UIKit
import Then
import SnapKit
import SnapKitExtend
import EZSwiftExtensions

class LZQ_DiscoverVC: BaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        
        let button = UILabel().then({
            $0.textColor = UIColor.red
            $0.text = "我是括号"
            $0.font = UIFont.systemFont(ofSize: 20)
            $0.textAlignment = .center
            
            view.addSubview($0)
            
            $0.snp.makeConstraints ({
                $0.left.right.equalToSuperview()
                $0.top.equalTo(kNavHeight)
                $0.height.equalTo(30)
            })
        })

        
        
        
        var arr1: Array<UIView> = [];
        for _ in 0..<4 {
            let subview = UIView()
            subview.backgroundColor = UIColor.red
            view.addSubview(subview)
            arr1.append(subview)
        }
        
        
        let view1 = UIView().then {
            $0.backgroundColor = UIColor.red
            view.addSubview($0)
        }
        
        let view2 = UIView().then {
            $0.backgroundColor = UIColor.gray
            view.addSubview($0)
        }
        
        let view3 = UIView().then {
            $0.backgroundColor = UIColor.green
            view.addSubview($0)
        }
        
        let arr = [view1,view2,view3]
        
        arr.snp.distributeViewsAlong(axisType: .horizontal, fixedSpacing: 10, leadSpacing: 10, tailSpacing: 10)
        arr.snp.makeConstraints {
            $0.height.equalTo(100)
            $0.top.equalTo(300)
        }

       let index = arr.indexes(of: view2)
        print(index)
        
    }



}
